<template>
  <div>
    <h3>父组件</h3>
    <div>count值：{{ count }}</div>
    <hr />
    <!-- 子组件 -->
    <child :count="count" :addCount="setCount" />
  </div>
</template>

<script>
import child from '@/components/child/index.vue'

export default {
  components: {
    child
  },
  data() {
    return {
      count: 100
    }
  },
  methods: {
    setCount(value = 1, cb = () => {}) {
      this.count += value
      cb()
    }
  }
}
</script>

<style lang="scss" scoped></style>
